import { onBeforeUnmount, onMounted, ref } from 'vue'
export function scrollTopShow(){
const scrollTopVal = ref(0)
function scrollEvent(){
    scrollTopVal.value=
    document.documentElement.scrollTop || document.body.scrollTop || window.pageYOffset
}
onMounted(() => {
    window.addEventListener('scroll',scrollEvent)
}),
onBeforeUnmount(()=>{
    window.removeEventListener('scroll',scrollEvent)
})
return scrollTopVal
}